home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / MPWTool / Includes / UCPlusTool.h < prev   
Encoding:
Text File  |  1996-04-03  |  3.8 KB  |  143 lines  |  [TEXT/MPS ]

  1. // UCPlusTool.h
  2. // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. //----------------------------------------------------------------------------------------
  5. // Simple framework for an MPW tool. NOTE - tools cannot currently be built with -debug
  6. //----------------------------------------------------------------------------------------
  7.  
  8. #ifndef __UCPLUSTOOL__
  9. #define __UCPLUSTOOL__
  10.  
  11. // MacApp
  12.  
  13. #ifndef __UOBJECT__
  14. #include "UObject.h"
  15. #endif
  16.  
  17. //----------------------------------------------------------------------------------------
  18. // Constants
  19. //----------------------------------------------------------------------------------------
  20.  
  21. extern const char* gCPlusToolVersion;
  22. extern const char* kErrorMarker;
  23.  
  24. //----------------------------------------------------------------------------------------
  25. // typedefs and structs
  26. //----------------------------------------------------------------------------------------
  27. struct KeyWordStruct
  28. {
  29.     char * keyword;
  30.     short keyvalue;
  31. };
  32.  
  33. // Keyword IDs. Negative numbers reserved for the framework
  34. enum
  35. {
  36.     kwP = -1000,
  37.     kwNoP,
  38.     kwT,
  39.     kwNoT,
  40.     kwHelp
  41. };
  42.  
  43.  
  44. //----------------------------------------------------------------------------------------
  45. // Forward and external classes
  46. //----------------------------------------------------------------------------------------
  47.  
  48. class TAssociation;
  49.  
  50.  
  51. //----------------------------------------------------------------------------------------
  52. // TCPlusTool
  53. //----------------------------------------------------------------------------------------
  54.  
  55. class TCPlusTool : public TObject
  56. {
  57.     MA_DECLARE_CLASS;
  58.     
  59. public:
  60.     TCPlusTool();
  61.         // Constructor
  62.     virtual ~TCPlusTool();
  63.         // Destructor
  64.         
  65.     void ICPlusTool(int argc, char** argv);
  66.         // Pass the argc and argv passed into your main.
  67.         
  68.     virtual void InstallKeyWord(const CStr255& keyword, short kw);
  69.     
  70.     virtual Boolean LookupKeyword(const CStr255& keyword, short& kw);
  71.     
  72.     virtual void InstallKeyWords();
  73.     
  74.     virtual void DoProcessFileArg(const CStr255& arg);
  75.     
  76.     virtual void DoProcessOptionArg(short kw);
  77.     
  78.     virtual void DoShowUsage();
  79.     
  80.     virtual void DoStartProgress();
  81.     
  82.     virtual void DoToolAction();
  83.     
  84.     virtual void GetNextArg(CStr255& nextArg);
  85.     
  86.     virtual void ProcessArg(const CStr255& arg);
  87.     
  88.     virtual void Run();
  89.     
  90.     virtual void Stop(const CStr255& msg);
  91.     
  92.     virtual void SyntaxError(const CStr255& suffix);
  93.  
  94. //----------------------------------------------------------------------------------------
  95. // data members
  96. //----------------------------------------------------------------------------------------
  97. public:
  98.  
  99.     TAssociation* fKeyWordList;                    // keywords to this command
  100.     
  101.     CStr255 fProgName;                            // Program's file name
  102.     
  103.     long fStartTicks;                            // tickcount at start of tool
  104.     
  105.     long fStartDateTime;                        // Date/ Time at start of tool
  106.     
  107.     char** fArgv;                                // command line arguments.
  108.     
  109.     int fArgc;                                    // number of command line arguments
  110.     
  111.     int fArgvIndex;                                // current argument being processed
  112.  
  113.     short fCursorCount;
  114.     
  115.     enum 
  116.     {                                            // for our spinning cursor
  117.         RC_Normal, RC_ParmErrs, RC_DontMatch, RC_Abort
  118.     } fRetCode;                                    // Return codes
  119.     
  120.     Boolean fInterrupted;                        // True ==> interrupted (command "." pressed)
  121.     
  122.     Boolean fProgress;                            // True for progress request
  123.     
  124.     Boolean fTime;                                // True for elapsed time request
  125.     
  126. };
  127.  
  128.  
  129. //----------------------------------------------------------------------------------------
  130. // Unit intialization
  131. //----------------------------------------------------------------------------------------
  132.  
  133. extern void InitUCPlusTool();
  134.  
  135.  
  136. //----------------------------------------------------------------------------------------
  137. // Globals defined by this unit
  138. //----------------------------------------------------------------------------------------
  139.  
  140. extern TCPlusTool* gCPlusTool;                    // The tool
  141.  
  142. #endif // __UCPLUSTOOL__
  143.